package com.cz.nongyetongv5.bean;

import java.io.Serializable;

/**
 * 给WheelView使用的Java Bean
 *
 * @author admin
 *
 */
public class TextInfo implements Serializable {

	// ID
	public Object id;

	// 文字
	public String mText;

	// 文字的color
	public int color = 0;

	// Code 编码
	public String code = null;

	public Object data = null;

	public TextInfo(Object id, String mText) {
		this.id = id;
		this.mText = mText;
	}

	public TextInfo(Object id, String mText, Object data) {
		this.id = id;
		this.mText = mText;
		this.data = data;
	}

	public TextInfo(Object id, String mText, int color, String code) {
		this.id = id;
		this.mText = mText;
		this.color = color;
		this.code = code;
	}

	public TextInfo(Object id, String mText, String code) {
		this.id = id;
		this.mText = mText;
		this.code = code;
	}

	public TextInfo(Object id, String mText, int color) {
		this.id = id;
		this.mText = mText;
		this.color = color;
	}

	public TextInfo() {
	}

	@Override
	public boolean equals(Object o) {

		boolean result = false;

		if (o != null) {

			if (o instanceof TextInfo) {

				TextInfo other = (TextInfo) o;

				if (other.id == this.id) {
					result = true;
				} else {

					if (other.id instanceof String && this.id instanceof String) {

						return this.id.equals(other.id);
					}

					if (other.id instanceof Integer
							&& this.id instanceof Integer) {

						int thisId = (Integer) this.id;

						int otherId = (Integer) other.id;

						if (thisId == otherId) {
							result = true;
						}

					}

					if (!result) {

						if (other.mText != null && this.mText != null) {

							if (other.mText.equals(this.mText)) {
								result = true;
							}

						}

					}

				}

			}

		}

		return result;

	}

}